package com.knight.study.patterns.tujie.visitor;

/**
 * @Author knight
 * @Date 2024/9/11 16:35
 */

public class VisitorMains {
    public static void main(String[] args) {
        try {
            System.out.println("Makint root entries...");
            final Directory rootdir = new Directory("root");
            final Directory bindir = new Directory("bin");
            final Directory tmpdir = new Directory("tmp");
            final Directory usrdir = new Directory("usr");
            rootdir.add(bindir);
            rootdir.add(tmpdir);
            rootdir.add(usrdir);
            bindir.add(new File("vi", 10000));
            bindir.add(new File("latex", 20000));
            rootdir.accept(new ListVisitor());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
